<template>
  <div id="app">
    <header class="head">
      <a class="back tl" href="javascript:history.back(-1)">
        <i class="el-icon-arrow-left"></i>
      </a>
      <a href="javascript:;" class="tc">
        <small class="font_18 co_f">清洗消毒详情</small>
      </a>
      <a class="operation" v-on:click="show = !show">
        <i class="el-icon-setting"></i> 操作
      </a>
  
      <!--dialog-->
      <transition name="fade">
        <div class="operatbox" v-show="show">
          <router-link :to='{name:"Qxxdlistupdate",query:{unid:this.unid,goodsName:listData.goodsName,num:listData.num,disinfectDate:listData.disinfectDate,way:listData.way,disinfectant:listData.disinfectant,note:listData.note,startHour:listData.startHour,startMin:listData.startMin,endHour:listData.endHour,endMin:listData.endMin,enterprisePerson:listData.enterprisePerson.unid}}'>修改</router-link>
          <a @click="handleDelete()">删除</a>
        </div>
      </transition>
    </header>
  
    <main>
      <div class="formcontent">
        <ul>
          <li>
            <span><em>*</em>物品（设施）名称</span>
            <div class="froms">
              <label>{{listData.goodsName}}</label>
            </div>
          </li>
          <li>
            <span><em></em>数量 </span>
            <div class="froms">
              <label>{{listData.num}}</label>
            </div>
          </li>
          <li>
            <span> <em></em>消毒日期 </span>
            <div class="froms">
              <label>{{listData.disinfectDate|time}}</label>
            </div>
          </li>
           <li>
            <span> <em></em>消毒方式 </span>
            <div class="froms">
              <label>{{listData.way}}</label>
            </div>
          </li>
           <li>
            <span> <em></em>开始时间 </span>
            <div class="froms">
              <label>{{listData.startHour}}:{{listData.startMin}}</label>
            </div>
          </li>
          <li>
            <span> <em></em>结束时间 </span>
            <div class="froms">
              <label>{{listData.endHour}}:{{listData.endMin}}</label>
            </div>
          </li>
           <li>
            <span><em>*</em>消毒人员</span>
            <div class="froms">
              <label>{{listData.enterprisePerson.name}}</label>
            </div>
          </li>
           <li>
            <span>  <em></em>消毒药剂 </span>
            <div class="froms">
              <label>{{listData.disinfectant}}</label>
            </div>
          </li>
           <li>
            <span> <em></em>备注 </span>
            <div class="froms">
              <label>{{listData.note}}</label>
            </div>
          </li>
        </ul>
      </div>
    </main>
  </div>
</template>
<script>
  import {DisinfectDelete} from '../../api/api';
  import {DisinfectDetail} from '../../api/api';
  export default {
    data() {
      return {
        listData: {},
        show: false, //默认隐藏
        unid:this.$route.query.unid,
      };
    },
    methods: {     
      //数据加载方法
      getData() {
        //定义需要传给通讯的参数： unid    
        let options = {
          params: {
            unid:this.unid,
          }
        }
  
        //调取接口
        DisinfectDetail(options).then((res) => {
          if (res.success === true) {
            this.listData = res.data;
            // console.log(res.data)
          }
        })
      },
      //删除方法
      handleDelete() {
      let deletParams={
         params: {
            unid:this.unid,
          }
      }
       this.$confirm('是否删除此条信息?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
      DisinfectDelete(deletParams).then((res) => {
          this.getData()
         if (res.success===true) {
                this.$message.success('删除成功');
                  this.$router.go(-1);
              } else {
                this.$message.error(res.msg);
              }
        });
      });
    },

    },
    created() {
      this.getData();
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>

</style>
